<?php
$s1=$_POST['s1'];
$s2=$_POST['s2'];
$fuhao=$_POST['fuhao'];
$sum='';
if($fuhao=='+'){$sum=$s1+$s2;}
if($fuhao=='-'){$sum=$s1-$s2;}
if($fuhao=='*'){$sum=$s1*$s2;}
if($fuhao=='/'){$sum=$s1/$s2;}
?>
<form method="post" action="">
    计算器<input type="text" name="s1" size="5" value="<?php echo $s1;?> "/>
    <select  name="fuhao">
        <option value="+"
            <?php  if($fuhao=='+'){echo "selected";};?>>+
        </option>
        <option value="-"
            <?php  if($fuhao=='-'){echo "selected";};?>>-
        </option>
        <option value="*"
            <?php  if($fuhao=='*'){echo "selected";};?>>*
        </option>
        <option value="/"
            <?php  if($fuhao=='/'){echo "selected";};?>>/
        </option>
    </select>
    <input type="text" name="s2" size="5" value="<?php echo $s2;?>"/>
    <input type="submit" name="dengyu" size="5" value="="/>
    <input type="text" name="sum" size="5" value="<?php echo $sum;?>"/>
</form>